home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 1 Issue 2 / PDCD-1 - Issue 02.iso / _utilities / utilities / 001 / meschach / !Meschach / ReadMe < prev   
Text File  |  1994-08-01  |  18KB  |  456 lines

  1.  
  2.  
  3.                      
  4.                  Meschach Library
  5.                    Version 1.2b
  6.  
  7.  
  8.                  David E. Stewart
  9.             (david.stewart@anu.edu.au)
  10.  
  11.                     and
  12.  
  13.                    Zbigniew Leyk
  14.             (zbigniew.leyk@anu.edu.au)
  15.  
  16.               School of Mathematical Sciences
  17.               Australian National University
  18.                  Canberra ACT 0200
  19.                  Australia
  20.  
  21.  
  22.               [last revised: 6th April, 1994]
  23.  
  24.  
  25.                   1. INTRODUCTION
  26.  
  27.    The Meschach Library is a numerical library of C routines for performing
  28. calculations on matrices and vectors. It is intended for solving systems of
  29. linear equations (dense and sparse), solve least squares problems,
  30. computing eigenvalues and eigenvectors, etc. We do not claim that it
  31. contains every useful algorithm in numerical linear algebra, but it does
  32. provide a basis on which more advanced algorithms can be built. The library
  33. is for people who know something about the C programming language,
  34. something of how to solve the numerical problem they are faced with but do
  35. not want to have the hassle of building all the necessary routines from the
  36. scratch. The library is not a loose collection of numerical routines but it
  37. comprises a coherent system. The current version is enhanced with many
  38. features comparing with previous versions. Since the memory requirements
  39. are nontrivial for large problems we have paid more attention to
  40. allocation/deallocation of memory.
  41.  
  42.    The source code is available to be perused, used and passed on without
  43. cost, while ensuring that the quality of the software is not compromised.
  44. The software is copyrighted; however, the copyright agreement follows in
  45. the footsteps of the Free Software Foundation in preventing abuse that
  46. occurs with totally public domain software.
  47.  
  48.    Detailed instructions for installing Meschach are contained below.
  49.  
  50.    Pronunciation: if in doubt, say "me-shark".  This is close enough.
  51. Don't ask us "Why call it that?"  Have a look at the quote at the front of
  52. the manual.
  53.  
  54.  
  55.                   2. AVAILABILITY
  56.  
  57.     The authors make this code openly available to others, in the hope that
  58. it will prove to be a useful tool.  We ask only that:
  59.  
  60. * If you publish results obtained using Meschach, please consider
  61.   acknowledging the source of the code.
  62.  
  63. * If you discover any errors in the code, please promptly communicate them
  64.   to the authors.
  65.  
  66.     We also suggest that you send email to the authors identifying yourself
  67. as a user of Meschach; this will enable the authors to notify you of any
  68. corrections/improvements in Meschach.
  69.  
  70.  
  71.  
  72.                  3. HOW TO GET IT
  73.  
  74.    There are several different forms in which you might receive Meschach.
  75. To provide a shorthand for describing collections of files, the Unix
  76. convention of putting alternative letters in [...] will be used.  (So,
  77. fred[123] means the collection fred1, fred2 and fred3.)  Meschach is
  78. available over Internet/AARnet via netlib, or at the anonymous ftp site
  79. thrain.anu.edu.au in the directory pub/meschach.  There are five .shar
  80. files: meschach[01234].shar (which contain the library itself),
  81. meschach0.shar (which contains basic documentation and machine dependent
  82. files for a number of machines).  Of the meschach[1234].shar files, only
  83. meschach[12].shar are needed for the basic Meschach library; the third
  84. .shar file contains the sparse matrix routines, and the the fourth contains
  85. the routines for complex numbers, vectors and matrices.  There is also a
  86. README file that you should get from meschach0.shar.
  87.  
  88.    If you need the old iterative routines, the file oldmeschach.shar
  89. contains the files conjgrad.c, arnoldi.c and lanczos.c.
  90.  
  91.    To get the library from netlib,
  92.  
  93. mail netlib@research.att.com
  94. send all from c/meschach
  95.  
  96.    There are a number of other netlib sites which mirror the main netlib
  97. sites.  These include netlib@ornl.gov (Oak Ridge, TN, USA), netlib@nac.no
  98. (Oslo, Norway), ftp.cs.uow.edu.au (Wollongong, Australia; ftp only),
  99. netlib@nchc.edu.tw (Taiwan), elib.zib-berlin.de (Berlin, Germany; ftp
  100. only).  (For anonymous ftp sites the directory containing the Meschach
  101. .shar files is pub/netlib/c/meschach or similar, possibly depending on the
  102. site.)
  103.  
  104.    Meschach is available in other forms on thrain.anu.edu.au by ftp in the
  105. directory pub/meschach.  It is available as a .tar file (mesch12a.tar for
  106. version 1.2a), or as a collection of .shar files, or as a .zip file.  The
  107. .tar and .zip versions each contain the entire contents of the Meschach
  108. library.
  109.  
  110.    There is a manual called "Meschach: Matrix Computations in C" which has
  111. been published by
  112.  
  113.     Centre for Mathematics and its Applications
  114.     School of Mathematical Sciences
  115.     Australian National University
  116.     Canberra, ACT 0200
  117.     Australia
  118.  
  119. and costs A$30 (about US$22) + postage/handling.  You can order it by
  120. writing there or you can send email messages to one of us
  121. (david.stewart@anu.edu.au or zbigniew.leyk@anu.edu.au) and we can pass it
  122. on.
  123.  
  124.    If you don't have any money, as a stop gap you can get the **OLD**
  125. manual, although it is out of date, by anonymous ftp from
  126.  
  127.     thrain.anu.edu.au : /pub/meschach/version1.1b/bookdvi.tar [.Z or .gz]
  128.  
  129. In addition, don't forget that the distribution includes a DOC directory
  130. which contains tutorial.txt and fnindex.txt which are respectively, the
  131. tutorial chapter (text version) and the function index (text version).
  132.  
  133.  
  134.  
  135.                   4. INSTALLATION
  136.  
  137.                 a) On Unix machines
  138.  
  139.    To extract the files from the .shar files, put them all into a suitable
  140. directory and use
  141.  
  142.   sh <file>.shar
  143.  
  144. to expand the files.  (Use one sh command per file; sh *.shar will not work
  145. in general.)
  146.  
  147.    For the .tar file, use
  148.  
  149.   tar xvf mesch12a.tar
  150.  
  151. and for the .zip file use
  152.  
  153.   unzip mesch12a.zip
  154.  
  155.    On a Unix system you can use the configure script to set up the
  156. machine-dependent files.  The script takes a number of options which are
  157. used for installing different subsets of the full Meschach.  For the basic
  158. system, which requires only meschach[012].shar, use
  159.  
  160.   configure
  161.   make basic
  162.   make clean
  163.  
  164.    For including sparse operations, which requires meschach[0123].shar, use
  165.  
  166.   configure --with-sparse
  167.   make sparse
  168.   make clean
  169.  
  170.   For including complex operations, which requires meschach[0124].shar, use
  171.  
  172.   configure --with-complex
  173.   make complex
  174.   make clean
  175.  
  176.    For including everything, which requires meschach[01234].shar, use
  177.  
  178.   configure --with-all
  179.   make all
  180.   make clean
  181.  
  182.   To compile the complete library in single precision (with Real equivalent
  183. to float), add the --with-float option to configure, use
  184.  
  185.   configure --with-all --with-float
  186.   make all
  187.   make clean
  188.  
  189.  
  190.    Some Unix-like systems may have some problems with this due to bugs or
  191. incompatibilities in various parts of the system.  To check this use make
  192. torture and run torture.  In this case use the machine-dependent files from
  193. the machines directory.  (This is the case for RS/6000 machines, the -O
  194. switch results in failure of a routine in schur.c.  Compiling without the
  195. -O switch results in correct results.)
  196.  
  197.    If you have problems using configure, or you use a non-Unix system,
  198. check the MACHINES directory (generated by meschach0.shar) for your
  199. machine, operating system and/or compiler.  Save the machine dependent
  200. files makefile, machine.c and machine.h.  Copy those files from the
  201. directory for your machine to the directory where the source code is.
  202.  
  203.    To link into a program prog.c, compile it using
  204.  
  205.   cc -o prog_name prog.c ....(source files).... meschach.a -lm
  206.  
  207.  
  208.    This code has been mostly developed on the University of Queensland,
  209. Australia's Pyramid 9810 running BSD4.3.  Initial development was on a
  210. Zilog Zeus Z8000 machine running Zeus, a Unix workalike operating system.
  211. Versions have also been successfully used on various Unix machines
  212. including Sun 3's, IBM RT's, SPARC's and an IBM RS/6000 running AIX.  It
  213. has also been compiled on an IBM AT clone using Quick C.  It has been
  214. designed to compile under either Kernighan and Richie, (Edition 1) C and
  215. under ANSI C.  (And, indeed, it has been compiled in both ANSI C and
  216. non-ANSI C environments.)
  217.  
  218.  
  219.               b) On non-Unix machines
  220.  
  221.    First look in the machines directory for your system type.  If it is
  222. there, then copy the machine dependent files machine.h, makefile (and
  223. possibly machine.c) to the Meschach directory.
  224.  
  225.    If your machine type is not there, then you will need to either compile
  226. ``by hand'', or construct your own makefile and possibly machine.h as well.
  227. The machine-dependent files for various systems should be used as a
  228. starting point, and the ``vanilla'' version of machine.h should be used.
  229. Information on the machine-dependent files follows in the next three
  230. subsections.
  231.  
  232.    On an IBM PC clone, the source code would be on a floppy disk. Use
  233.  
  234.   xcopy a:* meschach
  235.  
  236. to copy it to the meschach directory.  Then ``cd meschach'', and then
  237. compile the source code.  Different compilers on MSDOS machines will
  238. require different installation procedures.  Check the directory meschach
  239. for the appropriate ``makefile'' for your compiler.  If your compiler is
  240. not listed, then you should try compiling it ``by hand'', modifying the
  241. machine-dependent files as necessary.
  242.  
  243.    Worst come to worst, for a given C compiler, execute
  244.         <C compiler name> *.c
  245. on MS-DOS machines. For example,
  246.         tcc *.c
  247. for Turbo C, and
  248.         msc *.c
  249. for Microsoft C, or if you are using Quick C,
  250.         qcl *.c
  251. and of course
  252.         cc *.c
  253. for the standard Unix compiler.
  254.  
  255.    Once the object files have been generated, you will need to combine them
  256. into a library. Consult your local compiler's manual for details of how to
  257. do this.
  258.  
  259.    When compiling programs/routines that use Meschach, you will need to
  260. have access the the header files in the INCLUDE directory. The INCLUDE
  261. directory's contents can be copied to the directory where the
  262. programs/routines are compiled.
  263.  
  264.    The files in the DOC directory form a very brief form of documentation
  265. on the the library routines in Meschach. See the printed documentation for
  266. more comprehensive documentation of the Meschach routines.  This can be
  267. obtained from the authors via email.
  268.  
  269.    The files and directories created by the machines.shar shell archive
  270. contain the files machine.c machine.h and makefile for a particular
  271. machine/operating system/compiler where they need to be different.  Copy
  272. the files in the appropriate directory for your machine/operating
  273. system/compiler to the directory with the Meschach source before compiling.
  274.  
  275.  
  276.  
  277.                    c)  makefile
  278.  
  279.  
  280.    This is setup by using the configure script on a Unix system, based on
  281. the makefile.in file.  However, if you want to modify how the library is
  282. compiled, you are free to change the makefile.
  283.  
  284.    The most likely change that you would want to make to this file is to
  285. change the line
  286.  
  287.   CFLAGS = -O
  288.  
  289. to suit your particular compiler.
  290.  
  291.   The code is intended to be compilable by both ANSI and non-ANSI
  292. compilers.
  293.  
  294.    To achieve this portability without sacrificing the ANSI function
  295. prototypes (which are very useful for avoiding problems with passing
  296. parameters) there is a token ANSI_C which must be #define'd in order to
  297. take full advantage of ANSI C.  To do this you should do all compilations
  298. with
  299.  
  300.   #define ANSI_C 1
  301.  
  302.    This can also be done at the compilation stage with a -DANSI_C flag.
  303. Again, you will have to use the -DANSI_C flag or its equivalent whenever
  304. you compile, or insert the line
  305.  
  306.   #define ANSI_C 1
  307.  
  308. in machine.h, to make full use of ANSI C with this matrix library.
  309.  
  310.  
  311.                    d)  machine.h
  312.  
  313.    Like makefile this is normally set up by the configure script on Unix
  314. machines.  However, for non-Unix systems, or if you need to set some things
  315. ``by hand'', change machine.h.
  316.  
  317.    There are a few quantities in here that should be modified to suit your
  318. particular compiler.  Firstly, the macros MEM_COPY() and MEM_ZERO() need to
  319. be correctly defined here.  The original library was compiled on BSD
  320. systems, and so it originally relied on bcopy() and bzero().
  321.  
  322.    In machine.h you will find the definitions for using the standard ANSI C
  323. library routines:
  324.  
  325.   /*--------------------ANSI C--------------------*/
  326.   #include        <stddef.h>
  327.   #include        <string.h>
  328.   #define    MEM_COPY(from,to,size)  memmove((to),(from),(size))
  329.   #define    MEM_ZERO(where,size)    memset((where),'\0',(size))
  330.  
  331.    Delete or comment out the alternative definitions and it should compile
  332. correctly.  The source files containing memmove() and/or memset() are
  333. available by anonymous ftp from some ftp sites (try archie to discover 
  334. them). The files are usually called memmove.c or memset.c.
  335. Some ftp sites which currently (Jan '94) have a version of these files are
  336. munnari.oz.au (in Australia), ftp.uu.net, gatekeeper.dec.com (USA), and
  337. unix.hensa.ac.uk (in the UK).  The directory in which you will find
  338. memmove.c and memset.c typically looks like .../bsd-sources/lib/libc/...
  339.  
  340.    There are two further machine-dependent quantities that should be set.
  341. These are machine epsilon or the unit roundoff for double precision
  342. arithmetic, and the maximum value produced by the rand() routine, which is
  343. used in rand_vec() and rand_mat().
  344.  
  345.  
  346.    The current definitions of these are
  347.  
  348.   #define    MACHEPS    2.2e-16
  349.   #define    MAX_RAND 2.147483648e9
  350.  
  351.    The value of MACHEPS should be correct for all IEEE standard double
  352. precision arithmetic.
  353.  
  354.    However, ANSI C's <float.h> contains #define'd quantities DBL_EPSILON
  355. and RAND_MAX, so if you have an ANSI C compiler and headers, replace the
  356. above two lines of machine.h with
  357.  
  358.   #include <float.h>
  359.   /* for Real == float */
  360.   #define MACHEPS DBL_EPSILON
  361.   #define MAX_RAND RAND_MAX
  362.  
  363.    The default value given for MAX_RAND is 2^31 , as the Pyramid 9810 and
  364. the SPARC 2's both have 32 bit words.  There is a program macheps.c which
  365. is included in your source files which computes and prints out the value of
  366. MACHEPS for your machine.
  367.  
  368.    Some other macros control some aspects of Meschach.  One of these is
  369. SEGMENTED which should be #define'd if you are working with a machine or
  370. compiler that does not allow large arrays to be allocated.  For example,
  371. the most common memory models for MS-DOS compilers do not allow more than
  372. 64Kbyte to be allocated in one block.  This limits square matrices to be no
  373. more than 9090 .  Inserting #define SEGMENTED 1 into machine.h will mean
  374. that matrices are allocated a row at a time.
  375.  
  376.  
  377.  
  378.                   4. SAMPLE TESTS
  379.  
  380.     There are several programs for checking Meschach called torture
  381. (source: torture.c) for the dense routines, sptort (source: sptort.c) for
  382. the sparse routines, ztorture (source ztorture.c) for a complex version of
  383. torture, memtort (source memtort.c) for memory allocation/deallocation,
  384. itertort (source itertort.c) for iterative methods, mfuntort (source
  385. mfuntort.c) for computing powers of dense matrices, iotort (source
  386. iotort.c) for I/O routines.  These can be compiled using make by "make
  387. torture", "make sptort", etc.  The programs are part of meschach0.shar.
  388.  
  389.  
  390.                  5. OTHER PROBLEMS
  391.  
  392.    Meschach is not a commercial package, so we do not guarantee that
  393. everything will be perfect or will install smoothly.  Inevitably there will
  394. be unforeseen problems. If you come across any bugs or inconsistencies, please
  395. let us know.  If you need to modify the results of the configure script, or
  396. need to construct your own machine.h and makefile's, please send them to
  397. us.  A number of people sent us the machine dependent files for Meschach 1.1,
  398. but with the use of configure, and the new information needed for version
  399. 1.2, these machine dependent files don't have quite the right information.
  400. Hopefully, though, they are redundant.  Non-Unix platforms at present
  401. require ``manual'' installation.  Because of the variety of platforms
  402. (MS-DOS, Macintosh, VAX/VMS, Prime, Amiga, Atari, ....) this is left up to
  403. the users of these platforms.  We hope that you can use the distibutable
  404. machine-dependent files as a starting point for this task.
  405.  
  406.    If you have programs or routines written using Meschach v.1.1x, you
  407. should put the statement
  408.  
  409.    #include "oldnames.h"
  410.  
  411. at the beginning of your files.  This is because a large number of the
  412. names of the routines have been changed (e.g. "get_vec()" has become
  413. "v_get()").  This will enable you to use the old names, although all of the
  414. error messages etc., will use the new names.  Also note that the new
  415. iterative routines have a very different calling sequence.  If you need the
  416. old iterative routines, they are in oldmeschach.shar.
  417.  
  418.    If you wish to let us know what you have done, etc., our email
  419. addresses are
  420.  
  421.              david.stewart@anu.edu.au
  422.              zbigniew.leyk@anu.edu.au
  423.  
  424.     Good luck!
  425.  
  426.  
  427.                   ACKNOWLEDGMENTS
  428.  
  429.  
  430.     Many people have helped in various ways with ideas and suggestions.
  431. Needless to say, the bugs are all ours!  But these people should be thanked
  432. for their encouragement etc.  These include a number of people at
  433. University of Queensland: Graeme Chandler, David De Wit, Martin Sharry,
  434. Michael Forbes, Phil Kilby, John Holt, Phil Pollett and Tony Watts.  At the
  435. Australian National University: Mike Osborne, Steve Roberts, Margaret Kahn
  436. and Teresa Leyk.  Karen George of the University of Canberra has been a
  437. source of both ideas and encouragement.  Email has become significant part
  438. of work, and many people have pointed out bugs, inconsistencies and
  439. improvements to Meschach by email.  These people include Ajay Shah of the
  440. University of Southern California, Dov Grobgeld of the Weizmann Institute,
  441. John Edstrom of the University of Calgary, Eric Grosse, one of the netlib
  442. organisers, Ole Saether of Oslo, Norway, Alfred Thiele and Pierre
  443. Asselin of Carnegie-Mellon Univeristy, Daniel Polani of the University of
  444. Mainz, Marian Slodicka of Slovakia, Kaifu Wu of Pomona, Hidetoshi
  445. Shimodaira of the University of Tokyo, Eng Siong of Edinburgh, Hirokawa Rui
  446. of the University of Tokyo, Marko Slyz of the University of Michigan, and
  447. Brook Milligan of the University of Texas.  This list is only partial, and
  448. there are many others who have corresponded with us on details about
  449. Meschach and the like.  Finally our thanks go to all those that have had to
  450. struggle with compilers and other things to get Meschach to work.
  451.  
  452.                      
  453.  
  454.  
  455.  
  456.